import React from 'react';
import { Tabs, Table } from 'antd';

const ConstantParam = (props) => {
  const { value } = props;

  const columns = [
    {
      title: '数据源参数名',
      dataIndex: 'name',
    },
    {
      title: '数据源参数位置',
      dataIndex: 'positionLabel',
    },
    {
      title: '类型',
      dataIndex: 'typeLabel',
    },
    {
      title: '参数值',
      dataIndex: 'val',
      render: (text) => text.split('').map(() => '*'),
    },
  ];

  return (
    <>
      <Tabs>
        {value.thirdList.map(({ name, params }, index) => (
          <Tabs.TabPane key={index.toString()} tab={name}>
            <Table dataSource={params.filter((item) => item.val)} columns={columns} rowkey='id' pagination={false} />
          </Tabs.TabPane>
        ))}
      </Tabs>
    </>
  );
};
export default ConstantParam;
